cmake_minimum_required(VERSION 3.16)

project(VariableTest VERSION 1.0.0)

# 显示所有重要的CMake内置变量
message(STATUS "")
message(STATUS "=============== CMake 内置变量演示 ===============")
message(STATUS "")

# 目录相关变量
message(STATUS "📁 目录相关变量:")
message(STATUS "  CMAKE_SOURCE_DIR:         ${CMAKE_SOURCE_DIR}")
message(STATUS "  CMAKE_BINARY_DIR:         ${CMAKE_BINARY_DIR}")
message(STATUS "  CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "  CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
message(STATUS "")

# 项目相关变量
message(STATUS "🏗️  项目相关变量:")
message(STATUS "  PROJECT_NAME:             ${PROJECT_NAME}")
message(STATUS "  PROJECT_VERSION:          ${PROJECT_VERSION}")
message(STATUS "  PROJECT_SOURCE_DIR:       ${PROJECT_SOURCE_DIR}")
message(STATUS "  PROJECT_BINARY_DIR:       ${PROJECT_BINARY_DIR}")
message(STATUS "")

# 编译器相关变量
message(STATUS "🔧 编译器相关变量:")
message(STATUS "  CMAKE_CXX_COMPILER:       ${CMAKE_CXX_COMPILER}")
message(STATUS "  CMAKE_CXX_COMPILER_ID:    ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "  CMAKE_BUILD_TYPE:         ${CMAKE_BUILD_TYPE}")
message(STATUS "  CMAKE_CXX_STANDARD:       ${CMAKE_CXX_STANDARD}")
message(STATUS "")

# 系统相关变量
message(STATUS "💻 系统相关变量:")
message(STATUS "  CMAKE_SYSTEM_NAME:        ${CMAKE_SYSTEM_NAME}")
message(STATUS "  CMAKE_SYSTEM_VERSION:     ${CMAKE_SYSTEM_VERSION}")
message(STATUS "  CMAKE_SYSTEM_PROCESSOR:   ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "")

# 安装相关变量
message(STATUS "📦 安装相关变量:")
message(STATUS "  CMAKE_INSTALL_PREFIX:     ${CMAKE_INSTALL_PREFIX}")
message(STATUS "")

# 演示CMAKE_BINARY_DIR的使用
message(STATUS "🎯 CMAKE_BINARY_DIR 使用示例:")
message(STATUS "  可执行文件路径: ${CMAKE_BINARY_DIR}/bin/myapp")
message(STATUS "  库文件路径:     ${CMAKE_BINARY_DIR}/lib/libmylib.a")
message(STATUS "  临时文件路径:   ${CMAKE_BINARY_DIR}/temp/config.h")
message(STATUS "")

message(STATUS "==================================================")
message(STATUS "✅ CMAKE_BINARY_DIR 是由 CMake 自动设置的内置变量")
message(STATUS "📍 它的值取决于您运行 cmake 时指定的构建目录")
message(STATUS "🔄 无需手动定义，CMake 会根据构建上下文自动设置")
message(STATUS "==================================================")
message(STATUS "") 